<div data-role="content" class="jqm-content">
  <div class="red center">
    <?php echo $error; ?>
  </div>

  <form action="<?php echo Yii::app()->createUrl('intro/addMatch'); ?>" method="post">

    <div class="ui-grid-solo">
      Win:
      <fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">

        <select name="winMember[]" id="winMember1" >
          <option value="0">Choose Player</option>
          <?php foreach ($members as $memberId => $memberName): ?>
            <option value="<?php echo $memberId ?>"><?php echo $memberName ?></option>
          <?php endforeach; ?>
        </select>

        <select name="winMember[]" id="winMember2"  >
          <option value="0">Choose Player</option>
          <?php foreach ($members as $memberId => $memberName): ?>
            <option value="<?php echo $memberId ?>"><?php echo $memberName ?></option>
          <?php endforeach; ?>
        </select>
      </fieldset>
    </div>
    <br>
    <div class="ui-grid-solo">
      Lost:
      <fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">

        <select name="lostMember[]" id="lostMember1"  >
          <option value="0">Choose Player</option>
          <?php foreach ($members as $memberId => $memberName): ?>
            <option value="<?php echo $memberId ?>"><?php echo $memberName ?></option>
          <?php endforeach; ?>
        </select>

        <select name="lostMember[]" id="lostMember2"  >
          <option value="0">Choose Player</option>
          <?php foreach ($members as $memberId => $memberName): ?>
            <option value="<?php echo $memberId ?>"><?php echo $memberName ?></option>
          <?php endforeach; ?>
        </select>
      </fieldset>
    </div>
    <br>
    <div class="ui-grid-solo">
      <div data-role="fieldcontain">
        <div data-role="rangeslider">
          <label for="range-7a">Score:</label>
          <input name="score[]" id="range-7a" min="0" max="30" value="0" type="range">
          <label for="range-7b">Lost/win:</label>
          <input name="score[]" id="range-7b" min="0" max="30" value="21" type="range">
        </div>
      </div>

    </div>
    <div class="ui-grid-solo">
      <label for="number-4">Price:</label>
      <input data-clear-btn="true" name="price" pattern="[0-9]*" id="number-4" value="30000" type="number">
    </div>

    <div class="ui-grid-solo">
      <input value="Submit" type="submit" id="btn_submit" >
      <input value="Reset" type="reset">
    </div>


  </form>
</div><!Choose Player /content Choose Player>

<div data-role="popup" id="popupCloseLeft" class="ui-content" style="max-width:280px">
  <a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-left">Close</a>
  <p>Member Duplicate!!!</p>
</div>

<script>
  $(document).ready(function() {

    $('#btn_submit').click(function() {
      //check member trung
      var error = 0;
      if ($('#winMember1').val() != 0 && $('#winMember1').val() == $('#winMember2').val()) {
        error = error + 1;
      }
      if ($('#winMember1').val() != 0 && $('#winMember1').val() == $('#lostMember1').val()) {
        error = error + 1;
      }
      if ($('#winMember1').val() != 0 && $('#winMember1').val() == $('#lostMember2').val()) {
        error = error + 1;
      }
      if ($('#winMember2').val() != 0 && $('#winMember2').val() == $('#lostMember1').val()) {
        error = error + 1;
      }
      if ($('#winMember2').val() != 0 && $('#winMember2').val() == $('#lostMember2').val()) {
        error = error + 1;
      }
      if ($('#lostMember1').val() != 0 && $('#lostMember1').val() == $('#lostMember2').val()) {
        error = error + 1;
      }

      if (error > 0) {
        $( "#popupCloseLeft" ).popup("open");
        return false;
      }
    });
  });
</script>
